Skip to content

Human in the Loop, tool approval UI for DeepAgent#7077

Merged
hsy822 merged 18 commits intolanchain_deepagentfrom
feature/deepagent-human-in-the-loop
Apr 27, 2026
Merged

Human in the Loop, tool approval UI for DeepAgent#7077
hsy822 merged 18 commits intolanchain_deepagentfrom
feature/deepagent-human-in-the-loop

Conversation

@hsy822
Copy link
Copy Markdown
Collaborator

@hsy822 hsy822 commented Apr 14, 2026

Summary

Adds user approval flow for risky DeepAgent tool calls (write_file, edit_file, etc.).
Safe tools (read_file, ls) execute without interruption.'

What's included

  • ToolApprovalModal with diff view, inline editing, 60s timeout
  • Approval gate for both built-in filesystem tools and MCP tools
  • BackendProtocol compatibility fixes for deepagents library
  • Applied Yann's PR langchain skills #7080 changes: skills, thread_id, read() optional params, grep path fix
  • System prompt reinforcement to enforce tool usage for file operations
  • Fixed React StrictMode double-mount in ToolApprovalModal
  • Batched edit approval: multiple edit() calls are combined into a single diff review

Key Design Decisions

  • No chatHistory to agent: LangGraph checkpointer manages conversation state internally. buildChatPrompt() strips tool_use blocks, which caused LLM to skip tool calls.
  • Dual approval points: Built-in tools via RemixFilesystemBackend, MCP tools via ToolApprovalGate in RemixToolAdapter.
  • Edit batching: edit() accumulates changes in virtualContent, flushed as one combined diff when runAgent() completes or a non-edit tool is called.
  • Approve button: allows quick approval without opening the editor. Review Changes opens inline diff for selective accept/reject.

Status

  • Approve / Reject working (write_file, edit_file)
  • Filesystem backend write()/read()/edit() aligned with BackendProtocol
  • LLM hallucination fix (edit → write no longer skips tools)
  • MCP tools wrapped with approval gate
  • React StrictMode fix
  • Edit mode (modified content)
  • Cleanup debug logs + Proxy wrapper before merge

Target

lanchain_deepagent

@hsy822 hsy822 requested a review from STetsing April 14, 2026 06:27
@hsy822 hsy822 force-pushed the feature/deepagent-human-in-the-loop branch 3 times, most recently from 51e3c31 to 02f8f36 Compare April 20, 2026 07:40
@hsy822 hsy822 force-pushed the feature/deepagent-human-in-the-loop branch from b560bc9 to d4fbdae Compare April 22, 2026 06:11
@hsy822 hsy822 added ready-to-review PR ready to review and removed WIP do not merge labels Apr 23, 2026
@hsy822 hsy822 changed the title [WIP] Human in the Loop, tool approval UI for DeepAgent Human in the Loop, tool approval UI for DeepAgent Apr 23, 2026
Comment thread libs/remix-ai-core/src/inferencers/deepagent/RemixFilesystemBackend.ts Outdated
Comment thread libs/remix-ui/remix-ai-assistant/src/components/ToolApprovalModal.tsx Outdated
Copy link
Copy Markdown
Collaborator

@STetsing STetsing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Update the 1 minute timer approval to be handled properly by the LLM. As of now after timeout, it is handled as user rejection. It should be no input, then rejection.
  • remove the high risk tag on the approval viewer
  • remove all Icons

Comment thread libs/remix-ai-core/src/inferencers/deepagent/DeepAgentInferencer.ts
…rn via session thread_id, fix path duplication
@hsy822 hsy822 requested a review from STetsing April 27, 2026 04:45
@hsy822 hsy822 merged commit e02387f into lanchain_deepagent Apr 27, 2026
1 check passed
@hsy822 hsy822 deleted the feature/deepagent-human-in-the-loop branch April 27, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review PR ready to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants